@treePrefixCls: ~'rc-tree';
@treeNodePrefixCls: ~'@{treePrefixCls}-treenode';

.@{treePrefixCls} {
  margin: 0;
  border: 1px solid transparent;

  &-focused:not(&-active-focused) {
    border-color: cyan;
  }

  // padding: 5px;
  .@{treeNodePrefixCls} {
    margin: 0;
    padding: 0;
    line-height: 24px;
    white-space: nowrap;
    list-style: none;
    outline: 0;
    .draggable {
      color: #333;
      -moz-user-select: none;
      -khtml-user-select: none;
      -webkit-user-select: none;
      user-select: none;
      /* Required to make elements draggable in old WebKit */
      // -khtml-user-drag: element;
      // -webkit-user-drag: element;
    }

    &.dragging {
      background: rgba(100, 100, 255, 0.1);
    }

    &.drop-container {
      > .draggable::after {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        box-shadow: inset 0 0 0 2px red;
        content: '';
      }
      & ~ .@{treeNodePrefixCls} {
        border-left: 2px solid chocolate;
      }
    }
    &.drop-target {
      background-color: yellowgreen;
      & ~ .@{treeNodePrefixCls} {
        border-left: none;
      }
    }
    &.filter-node {
      > .@{treePrefixCls}-node-content-wrapper {
        color: #a60000 !important;
        font-weight: bold !important;
      }
    }
    ul {
      margin: 0;
      padding: 0 0 0 18px;
    }
    .@{treePrefixCls}-node-content-wrapper {
      position: relative;
      display: inline-block;
      height: 24px;
      margin: 0;
      padding: 0;
      text-decoration: none;
      vertical-align: top;
      cursor: pointer;
    }
    span {
      &.@{treePrefixCls}-switcher,
      &.@{treePrefixCls}-checkbox,
      &.@{treePrefixCls}-iconEle {
        display: inline-block;
        width: 16px;
        height: 16px;
        margin-right: 2px;
        line-height: 16px;
        vertical-align: -0.125em;
        background-color: transparent;
        background-image: url('');
        background-repeat: no-repeat;
        background-attachment: scroll;
        border: 0 none;
        outline: none;
        cursor: pointer;

        &.@{treePrefixCls}-icon__customize {
          background-image: none;
        }
      }
      &.@{treePrefixCls}-icon_loading {
        margin-right: 2px;
        vertical-align: top;
        background: url('')
          no-repeat scroll 0 0 transparent;
      }
      &.@{treePrefixCls}-switcher {
        &.@{treePrefixCls}-switcher-noop {
          cursor: auto;
        }
        &.@{treePrefixCls}-switcher_open {
          background-position: -93px -56px;
        }
        &.@{treePrefixCls}-switcher_close {
          background-position: -75px -56px;
        }
      }
      &.@{treePrefixCls}-checkbox {
        width: 13px;
        height: 13px;
        margin: 0 3px;
        background-position: 0 0;
        &-checked {
          background-position: -14px 0;
        }
        &-indeterminate {
          background-position: -14px -28px;
        }
        &-disabled {
          background-position: 0 -56px;
        }
        &.@{treePrefixCls}-checkbox-checked.@{treePrefixCls}-checkbox-disabled {
          background-position: -14px -56px;
        }
        &.@{treePrefixCls}-checkbox-indeterminate.@{treePrefixCls}-checkbox-disabled {
          position: relative;
          background: #ccc;
          border-radius: 3px;
          &::after {
            position: absolute;
            top: 5px;
            left: 3px;
            width: 5px;
            height: 0;
            border: 2px solid #fff;
            border-top: 0;
            border-left: 0;
            -webkit-transform: scale(1);
            transform: scale(1);
            content: ' ';
          }
        }
      }
    }
  }
  &:not(.@{treePrefixCls}-show-line) {
    .@{treeNodePrefixCls} {
      .@{treePrefixCls}-switcher-noop {
        background: none;
      }
    }
  }
  &.@{treePrefixCls}-show-line {
    .@{treeNodePrefixCls}:not(:last-child) {
      > ul {
        background: url('')
          0 0 repeat-y;
      }
      > .@{treePrefixCls}-switcher-noop {
        background-position: -56px -18px;
      }
    }
    .@{treeNodePrefixCls}:last-child {
      > .@{treePrefixCls}-switcher-noop {
        background-position: -56px -36px;
      }
    }
  }
  &-child-tree {
    display: none;
    &-open {
      display: block;
    }
  }
  &-treenode-disabled {
    > span:not(.@{treePrefixCls}-switcher),
    > a,
    > a span {
      color: #767676;
      cursor: not-allowed;
    }
  }
  &-treenode-active {
    background: rgba(0, 0, 0, 0.1);

    // .@{treePrefixCls}-node-content-wrapper {
    //   background: rgba(0, 0, 0, 0.1);
    // }
  }
  &-node-selected {
    background-color: #ffe6b0;
    box-shadow: 0 0 0 1px #ffb951;
    opacity: 0.8;
  }
  &-icon__open {
    margin-right: 2px;
    vertical-align: top;
    background-position: -110px -16px;
  }
  &-icon__close {
    margin-right: 2px;
    vertical-align: top;
    background-position: -110px 0;
  }
  &-icon__docu {
    margin-right: 2px;
    vertical-align: top;
    background-position: -110px -32px;
  }
  &-icon__customize {
    margin-right: 2px;
    vertical-align: top;
  }
  &-title {
    display: inline-block;
  }
  &-indent {
    display: inline-block;
    height: 0;
    vertical-align: bottom;
  }
  &-indent-unit {
    display: inline-block;
    width: 16px;
  }

  &-draggable-icon {
    display: inline-flex;
    justify-content: center;
    width: 16px;
  }
}
